﻿using System;
using System.Windows.Input;
using GalaSoft.MvvmLight.Command;
using JustinAngel.Neurons.Framework;
using JustinAngel.Neurons.Framework.Helpers;
using JustinAngel.Neurons.Framework.Navigation;
using JustinAngel.UnitedNationsNews.AppCore;
using JustinAngel.UnitedNationsNews.Framework;
using JustinAngel.UnitedNationsNews.Services;
using Newtonsoft.Json;
using Ninject;

namespace JustinAngel.UnitedNationsNews.ItemViewMoels
{
    [JsonObject(MemberSerialization.OptIn)]
    public class VideoItemViewModel : VViewModelBase, IShareableOnSocialNetworks
    {
        public Uri Link
        {
            get { return YouTubeUrl; }
        }

        [JsonProperty]
        public string Title { get; set; }

        public string Content
        {
            get { return string.Empty; }
        }

        [JsonProperty]
        public Uri YouTubeUrl { get; set; }

        [JsonProperty]
        public Uri ImageUri { get; set; }

        public string YouTubeID
        {
            get
            {
                return YouTubeUrl.OriginalString
                    .Remove("&feature=youtube_gdata")
                    .Remove("http://www.youtube.com/watch?v=");
            }
        }

        public ICommand NavigateToVideo
        {
            get
            {
                return new RelayCommand(() =>
                    IoC.Get<ITaskInvoker>().OpenWebBrowser(YouTubeUrl.OriginalString));
                //MessengerInstance.Send(new NavigateToMessage(PageSources.VideoPage, this)));
            }
        }

        public bool IsNowPlayingRestore { get; set; }
        public bool IsHistoryTileRestore { get; set; }

      
    }
}